package com.gitee.wsl.unit.angle.ext

import com.gitee.wsl.unit.angle.AngleUnit

/**
 * Obtain an angle from a given number of positive degrees and decimal minutes.
 *
 * @param degrees integer number of degrees, positive.
 * @param minutes double representing the decimal representation of minutes and seconds.
 *
 * @return a new angle whose size in degrees is given by `degrees` and decimal `minutes`.
 *
 * @throws IllegalArgumentException if minutes or seconds are outside the 0-60 range or the degrees is negative.
 */
fun AngleUnit.Companion.fromDM(degrees: Int, minutes: Double): AngleUnit {
    require(degrees >= 0) {
        //logMessage(ERROR, "Angle", "fromDM", "invalidDegrees")
    }
    require(minutes >= 0 && minutes < 60) {
        //logMessage(ERROR, "Angle", "fromDM", "invalidMinutes")
    }
    return fromDegrees(degrees + minutes / 60.0)
}